<template>
	<div>
		<a-form :label-col="{span: 2}" :wrapper-col="{span: 14}">
			<a-form-item label="appID">
				<a-input v-model:value="formData.AppId" style="width: 300px;" />
			</a-form-item>
			<a-form-item label="AppSecret">
				<a-input v-model:value="formData.AppSecret" />
			</a-form-item>
			<a-form-item label="url">
				<a-input v-model:value="formData.url" />
			</a-form-item>
			<a-form-item label="创作者用户ID">
				<a-input v-model:value="formData.user_id" />
				<p class="font-13 grey">创作者用户ID，资源导入到指定用户，在用户管理中获取</p>
			</a-form-item>

			<a-form-item :wrapper-col="{ span: 14, offset: 2 }">
				<a-button type="primary" class="m-r-10" @click="onSubmit">保存</a-button>
				<a :href="apiServeUrl" target="_blank" class="m-l-20">申请开通同步功能</a>
			</a-form-item>
		</a-form>
	</div>
</template>

<script>
	import systemApi from '../../api/system.js'
	
	export default {
		data() {
			return {
				formData: {
					AppId: '',
					AppSecret: '',
					url: '',
					user_id: ''
				},
				
				apiServeUrl: 'https://tao.netss.cn/member/serve/content'
			}
		},
		mounted() {
			this.getSystemConfig()
		},
		methods: {
			onSubmit() {
				systemApi.systemConfig(this.formData, 'apiService').then(res => {
					if(res.status == 1){
						this.$message.success('修改成功')
					}
				})
			},
			getSystemConfig() {
				systemApi.getSystemConfig('apiService').then(res => {
					if(res.status == 1 && res.result?.apiService){
						this.formData = res.result.apiService
					}
				});
			},
		}
	}
</script>

<style scoped>
</style>